package com.ruoyi.activiti.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.Page;
import com.ruoyi.activiti.domain.dto.ActTaskDTO;
import com.ruoyi.activiti.domain.dto.ActivitiHighLineDTO;
import com.ruoyi.activiti.service.IActivitiHistoryService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.page.TableSupport;


@RestController
@RequestMapping("/activitiHistory")
public class ActivitiHistoryController extends BaseController {

    @Autowired
    private IActivitiHistoryService activitiHistoryService;

    //流程图高亮
    @GetMapping("/gethighLine")
    public AjaxResult gethighLine(@RequestParam("instanceId") String instanceId) {

        ActivitiHighLineDTO activitiHighLineDTO = activitiHistoryService.gethighLine(instanceId);
        return AjaxResult.success(activitiHighLineDTO);


    }

    // 我的：已办
    @GetMapping("/task/done")
    public TableDataInfo getTasksDone() {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Page<ActTaskDTO> hashMaps = activitiHistoryService.getTasksDone(pageDomain);
        return getDataTable(hashMaps);
    }
    // 我的：已办：限制key
    @GetMapping("/task/done/{processDefinitionKey}")
    public TableDataInfo getTasksDoneKey(@PathVariable("processDefinitionKey") String processDefinitionKey) {
        PageDomain pageDomain = TableSupport.buildPageRequest();
        Page<ActTaskDTO> hashMaps = activitiHistoryService.getTasksDone(pageDomain, processDefinitionKey);
        return getDataTable(hashMaps);
    }
}
